<?php

namespace App\Services\Article;

use App\Services\ProjectValidate;

/**
 * 文章设置验证
 * Class ValidateSetting
 * @package App\Services\Setting
 */
class ValidateArticle extends ProjectValidate
{

    /**
     * 自定义子类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        if (!empty($initData['requiredId'])) {
            $this->rules['id']  = 'required|int|min:1';
        }
    }


    /**
     * @var array 验证规则集合
     */
    public $rules = [
        'id'          => 'required',
        'department_ids'          => 'required',
        'title'       => 'required|min:2|max:50',
//        'classify_id' => 'required',
        'author'      => 'required|min:2|max:10',
        'shortname'   => 'required|min:2|max:15',
        'keywords'    => 'required|min:2|max:30',
        'description' => 'required|min:2|max:30',
        'content'     => 'required',
        'writer_id'   => 'required',
        'nickname'    => 'required',
        'audit_id'    => 'required',
        'visible'     => 'array|max:10',
        'invisible'   => 'array|max:10',
    ];

    /**
     * @var array 当前验证错误信息
     */
    public $messages = [

    ];
}